<?php
if (empty($argv[1])) {
    echo "You need to provide a search phrase\n";
    die(1);
}

setlocale(LC_CTYPE, 'de_DE.utf-8');
ini_set('display_errors', true);
ini_set('include_path', '.'.PATH_SEPARATOR.realpath(dirname(__FILE__).'/../library/'));
ini_set('error_log', 'stdout://');

function __autoload($class)
{
    if ('Zend' == substr($class, 0, 4)) {
        Zend_Loader::loadClass($class);
    }
}

require_once '../library/Zend/Loader.php';
require 'Indexer/Searchable.php';
require 'Indexer/Document.php';
require 'Indexer/Service.php';

$dataDir = realpath(dirname(__FILE__).'/../data/default/');
$phrase = $argv[1];

echo "\nTesting with '$phrase' in '$dataDir'...\n";

$idx = new Marjory_Service('default');
echo "\nSearching the document...\n";
$result = $idx->search($phrase);

var_dump($result);
